package com.baizhi.controller;

import com.baizhi.Student;
import com.baizhi.service.StudentService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class StudentController {
    @Autowired
    private StudentService ss;
    @GetMapping("students")
    private Map<String,Object> selectPage(int page,int limit){
        final PageInfo<Student> pageInfo = ss.selectByPage(page, limit);
        return new HashMap(){{
            put("code",0);
            put("msg","");
            put("count",pageInfo.getTotal());
            put("data",pageInfo.getList());
        }};
    }
}
